require(['jquery', 'cookie', 'lay', 'vue', 'config','tool','m_level'], function ($) {
    $(".layui-container").css("width", "100%");
    $(".layui-container").css("padding", "0");
    layui.use(['form', 'tree'], function () {
        var form = layui.form;
        var tree = layui.tree;
        var layer = layui.layer;
        form.render();
        //初始是可视
        tree.render({
            elem: '.WidgetBox' //默认是点击节点可进行收缩
            , data: WidgetBox_VIEW
            , click: function (obj) {
                var data = obj.data;  //获取当前点击的节点数据
                cachePlan(data.id);
            }
        });
        form.on('select(WidgetTypes)', function (data) {
            switch (data.value) {
                case "view": {
                    tree.render({
                        elem: '.WidgetBox' //默认是点击节点可进行收缩
                        , data: WidgetBox_VIEW
                    });
                }
                    ;
                    break;
                case "model": {
                    tree.render({
                        elem: '.WidgetBox' //默认是点击节点可进行收缩
                        , data: WidgetBox_MODEL
                    });
                }
                    ;
                    break;
                case "control": {
                    tree.render({
                        elem: '.WidgetBox' //默认是点击节点可进行收缩
                        , data: WidgetBox_Control
                    });
                }
                    ;
                    break;
            }
        });
    });
    require(['vue'],function (Vue) {
        var laber = new Vue({
            el:".laber",
            data:{
                object:"",
                type:""
            }
        })
    })
});

function allowDrop(ev) {
    ev.preventDefault();
}

function drag(ev) {
    ev.dataTransfer.setData("Text", ev.target.id);
}

function drop(ev) {
    ev.preventDefault();
    var data = ev.dataTransfer.getData("Text");
    ev.target.appendChild(document.getElementById(data));
}
function cachePlan(funtions) {
    eval(funtions+"()");
}
//
function v_101() {
    var innterHTML = "<div onclick='level_nature(this)' id='"+getDete("r")+"' class='palette level' draggable='true' ondragstart='drag(event)'></div>";
    $(".cache").html(innterHTML);
}